class Point{
		protected int x,y;
		
		public Point(int x, int y){
			this.x=x;
			this.y=y;
		}
		
		public double distance(Point p1, Point p2){
			return Math.sqrt((p2.x-p1.x)*(p2.x-p1.x)+(p2.y-p1.y)*(p2.y-p1.y));
		}
		
		public String toString(){
			return "x="+x+", y="+y;
		}
		
}

class Point3D extends Point{
	protected int z;	
	
	public Point3D(int x, int y, int z){
		super(x,y);
		this.z=z;
	}
	
	public double distance(Point3D p1, Point3D p2){
		return Math.sqrt((p2.x-p1.x)*(p2.x-p1.x)+(p2.y-p1.y)*(p2.y-p1.y)+(p2.z-p1.z)*(p2.z-p1.z));
	}
	
	public String toString(){
		return super.toString()+", z="+z;
	}
	
}


public class Aufgabe1 {		

	public static void main(String[] args) {
		Point a=new Point(3,4), b=new Point(1,5);
		System.out.println("a: "+a.toString()+"; b: "+b.toString()+"; Distance: "+a.distance(a,b));
		Point3D c=new Point3D(3,4,5), d=new Point3D(1,5,2);
		System.out.println("c: "+c.toString()+"; d: "+d.toString()+"; Distance: "+c.distance(c,d));
	}

}
